feat: add AthenaQueryPolicy_v2 with current Athena API actions#3953
Open
roger-zhangg wants to merge 4 commits into
Open
feat: add AthenaQueryPolicy_v2 with current Athena API actions#3953roger-zhangg wants to merge 4 commits into
roger-zhangg wants to merge 4 commits into
Conversation
Adds AthenaQueryPolicy_v2 using current (non-deprecated) Athena APIs while preserving the original AthenaQueryPolicy unchanged for backward compatibility. This follows the established _v2 pattern used by KMSEncryptPolicy_v2, StepFunctionsExecutionPolicy_v2, etc. Fixes aws#3785
ac2961c to
0eed981
Compare
Address security review feedback: - Remove athena:GetWorkGroup from Statement 1 (Resource: *) since it is already granted in Statement 2 scoped to the specific workgroup - Move athena:GetDatabase and athena:GetTableMetadata to Statement 2 (workgroup-scoped) for least-privilege - Keep only list/discover actions in Statement 1 (Resource: *) since those don't support resource-level permissions - Regenerate all 3 partition test expected outputs
These actions operate on the datacatalog resource type, not workgroup. Placing them in the workgroup-scoped statement would result in AccessDenied at runtime since the ARN shapes don't match. Statement 1 (Resource: *) now contains: - List/discover actions (ListWorkGroups, ListDataCatalogs, etc.) - Datacatalog-scoped actions (GetDatabase, GetTableMetadata) - Glue equivalents (GetDatabase, GetDatabases, GetTable, GetTables) Statement 2 (workgroup ARN) contains: - Query execution actions - GetWorkGroup (correctly scoped to specific workgroup) Regenerated all 3 partition test expected outputs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
AthenaQueryPolicy_v2with current (non-deprecated) Athena API actions, following the established_v2pattern.The original
AthenaQueryPolicyis preserved unchanged for backward compatibility (per DEVELOPMENT_GUIDE.md: "A specific SAM template should always transform into the same CloudFormation template").Changes
AthenaQueryPolicy_v2with updated actions (athena:GetWorkGroup,athena:ListDataCatalogs,athena:GetDatabase,athena:ListDatabases,athena:ListTableMetadata,athena:GetTableMetadata) + required Glue Data Catalog permissions (glue:GetDatabase,glue:GetDatabases,glue:GetTable,glue:GetTables)AthenaQueryPolicy(deprecated APIs still work, users won't see silent IAM changes on stack update)Migration
Users should update their SAM templates from
AthenaQueryPolicytoAthenaQueryPolicy_v2at their convenience.Fixes #3785